<template>
    <el-menu-item :index="code" v-if="!children">
      <el-icon><span class="iconfont icon-shouye"></span></el-icon>
      <template #title>
        <span class="!text-white ml-3">{{ label }}</span>
      </template>
    </el-menu-item>
    <el-sub-menu :index="code" v-else>
      <template #title>
        <el-icon> <span class="iconfont icon-shebeiguanli"></span> </el-icon>
  
        <span class="!text-white ml-3">{{ label }}</span>
      </template>
      <MenuItem
        v-for="item in children"
        :label="item.name"
        :children="item.children"
        :code="item.code"
      >
      </MenuItem>
    </el-sub-menu>
  </template>
  
  <script setup lang="ts">
  const props = defineProps<{
    label: string
    code: string
    children?: any[]
  }>()
  </script>
  
  <style scoped></style>
  